<template>
  <component :is="currentIconComponent" :type="getType"></component>
</template>

<script>
import SvgIcon from './SvgIcon'

export default {
  name: 'CustomIcon',
  components: {
    SvgIcon
  },
  data () {
    return {
      iconType: ''
    }
  },
  props: {
    type: {
      type: String,
      required: true
    }
  },
  computed: {
    currentIconComponent: function () {
      if (this.type.indexOf('svg-') === 0) {
        return 'SvgIcon'
      } else {
        return 'AIcon'
      }
    },
    getType: function () {
      if (this.type.indexOf('svg-') === 0) {
        return this.type.replace('svg-', '')
      } else {
        return this.type
      }
    }
  }
}
</script>

<style>
</style>
